﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Client.Domain;
using DeadSimpleDTO;

namespace ConsoleAppWithLoader
{
    class Program
    {
        static void Main(string[] args)
        {
            var loader = new DeadSimpleLoader("Northwind");



            Console.WriteLine("Get one by PK\r\n");

            Categories cat = loader.Get<Categories>(1);
            
            Console.WriteLine("Loaded category {0}:{1}", cat.CategoryID, cat.CategoryName);
            Console.WriteLine("\r\n");



            Console.WriteLine("Select All\r\n");
            var cats = loader.Select<Categories>();
            foreach (Categories item in cats)
            {
                Console.WriteLine("Loaded category {0}:{1}", item.CategoryID, item.CategoryName);    
            }
            Console.WriteLine("\r\n");



            Console.WriteLine("Select where CategoryID > 4\r\n");

            cats = loader.Select<Categories>("CategoryId > 4");
            foreach (Categories item in cats)
            {
                Console.WriteLine("Loaded category {0}:{1}", item.CategoryID, item.CategoryName);
            }

            Console.WriteLine("\r\n");
            Console.WriteLine("Press enter to exit."); //<- is there a better way to put that?
            Console.ReadLine();
        }
    }
}
